Minimum delay dilation/erosion filter

ABSTRACT

A filter for performing dilation and/or erosion operations associated with mathematical morphology using a W×H rectangular structuring element to a two-dimensional matrix of discrete values, the width of the matrix being x and the height being y, includes a horizontal portion for applying the selected operation to a W×1 local neighbourhood and a vertical portion for applying the selected operation to a 1×H local neighbourhood. According to one aspect of the filer, the portions are connected one after the other and the matrix elements are applied serially to the first portion, the output of one portion being connected to the input of the other portion. Each of the above-mentioned portions includes a multiplicity of delay devices, each device providing an equal delay, and a multiplicity of comparing devices for comparing two input values. Each comparing device can produce a selected one of the lesser or greater of the input values at their output so as to permit erosion and dilation operations, respectively. According to another aspect of the invention, each portion includes a set of identical operator elements connected one after another, the horizontal portion having W such operator elements while the vertical portion having H such operator elements.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a filter for applying dilation and/orerosion operations of mathematical morphology using a W×H rectangularstructuring element to a two-dimensional matrix of discrete values, thewidth of the matrix being x and the height being y,

the filter comprising a horizontal portion for applying said dilation orerosion operation to a W×1 local neighbourhood and a vertical portionfor applying said dilation or erosion operation to a 1×H localneighbourhood,

whereby the portions are connected one after the other and the matrixelements are applied serially to the first portion, the output of oneportion being connected to the input of the other portion,

wherein the portions comprise a multiplicity of delay means, eachproviding an equal delay, and a multiplicity of comparing means forcomparing two input values and producing the lesser or greater of thesevalues at their output, in the cases of erosion and dilationrespectively,

wherein each portion comprises a set of identical operator elementsconnected one after another, the horizontal portion comprising W suchoperator elements, and the vertical portion comprising H such operatorelements.

2. Description of Related Art

Mathematical morphology is a formal method of shape representation andanalysis. Basic operations thereof are erosion and dilation, by chainingof which in a suitable manner it is possible to provide, e.g., effectiveand usable image processing methods. For instance, many applications ofcomputer vision, such as pattern recognition, are based on the use ofmorphological operators.

In mathematical morphology, the basic operations process the image bymeans of so-called structuring elements. A structuring element is aneighbourhood in which an operator is effective. In gray-scalemorphology, dilation stands for the maximum of the local neighbourhooddefined by the structuring element and erosion stands for the minimum,respectively.

Basic data to be processed has been arranged in the form of a matrix, inwhich each line comprises x samples and the total number of lines is y.In the following example, the dilation and erosion operations for basicdata of the size of x=6 and y=6 are examined. The local neighbourhood isrectangular with the dimensions W=3 and H=3, where W is a horizontal andH a vertical dimension.

                  TABLE 1                                                         ______________________________________                                        Erosion and dilation operations performed on basic data                       in neighbourhood 3*3                                                          ______________________________________                                         ##STR1##                                                                      ##STR2##                                                                     ______________________________________                                    

Traditionally, operators are realized by means of the structure ofFIG. 1. It comprises delay means D connected one after another to formhorizontal lines, each line comprising W delay means, which lines, H innumber, are chained one after another in such a way that between eachhorizontal line is connected a delay line, the length of which is X-W)times the delay of one delay means D. In this structure, a processingmeans has to be connected to each delay means D of each horizontal line,whereby the processing means has to compare W×H values with each otherto find the minimum/maximum value desired. Thus the processing meanswill be quite complicated and therefore also slow. An image processingunit realized in this manner in principle is disclosed, e.g., by U.S.patent specification No. 4,692,943.

A filter defined in the opening paragraph can be formed on the basis ofinformation given in NONLINEAR IMAGE PROCESSING, vol. 1247, 15 Feb 1990,Santa Clara, Calif., pages 145-156; A.C.P. LOUI et al.: "High-speedarchitectures for morphological image processing". This reference showsa serial combination of a number of identical elements to form dilationand/or erosion processors and gives the teaching that a two-dimensionaldilation/erosion operation can be accomplished by coupling serially ahorizontal and a vertical portion. The elements used for the dilationand/or erosion processors include, however, several components and theserial combinations formed thereby are slow in operation.

SUMMARY OF THE INVENTION

To solve the problems attached to the prior art filter structures andcaused especially by difficulty of extension, complexity of structureand consequent slow operation, the filter of the invention ischaracterized by each of said operator elements consisting of onecomparing means and one delay means, the output of the comparing meansbeing connected to the input of the delay means, the output of the delaymeans of a preceding operator element being connected to the first inputof the comparing means of the following operator element,

the input of the horizontal portion being connected to the first inputof the comparing means of the first operator element and also to thesecond input of the comparing means of each operator element in the thehorizontal portion, the output of the Wth operator element forming theoutput of the horizontal portion,

the said vertical portion further comprising H delay lines eachcomprising X+1 further delay means connected one after another, theinput of the vertical portion being connected to both first and secondinputs of the comparing means of the first operator element of thevertical portion and also to the input of the first of the delay lines,the output of each delay line being connected both to the second inputof the comparing means of the following operator element and to theinput of the following delay line, and the output of the Hth operatorelement forming the output of the vertical portion.

In this filter structure of the invention, basic data x*y is processedby a dilation or erosion operation in a local neighbourhood W*H, whichis made to slide over the basic data x*y. According to the method, theoperations of dilation and erosion are performed in such a way that themaximum (dilation) or the minimum (erosion) is at first searched for ina local neighbourhood W*1 (horizontal portion). In the result obtainedin this way, the maximum (dilation) or the minimum (erosion) is thensearched for in a local neighbourhood 1*H (vertical portion). Theperforming order of the horizontal and vertical portions can also bereverse.

To visualize the function of the filter, the function of a horizontaloperator performing the minimum operation (erosion) is examined by wayof example. The function is depicted in Table 2. The uppermosthorizontal line represents an incoming data stream delayed by one clockperiod (=MIN1) in which stream the minimum is searched for in aneighbourhood, (5*1 in this case). Each line represents the minimumvalue of a certain neighbourhood, which value can be calculated in themanner presented in the table. The arrows show from which values theminimum value is generated each time. The columns against show thesituation at a certain moment. The table presents the operationsrequired for the calculation of three successive minimum values.

                                      TABLE 2                                     __________________________________________________________________________    Operating principle of a horizontal minimum (erosion)                         filter operating in neighbourhood 5*1.                                        __________________________________________________________________________     ##STR3##                                                                                                      ##STR4##                                      ##STR5##                                                                                                      ##STR6##                                      ##STR7##                                                                                                      ##STR8##                                     __________________________________________________________________________

In the method, the minimum is searched for in successive samples n, n+1,n+2, n+3, . . . , n+(W-1).

Sample n (=minimum in neighbourhood 1*1=MIN1=MIN{n}) is received by theinput of the horizontal portion at a moment t, sample n+1 at a momentt+1 etc. During t+1 the minimum is calculated from the samples n and n+1and the result is the minimum in neighbourhood 2+1, i.e. MIN2(=min{MIN1,n+1}=min{n,n+1}). During t+2 the minimum is calculated fromthe samples n+2 and MIN2 and the result is the minimum in neighbourhood3*1, i.e. MIN3 (=min{MIN2,n+2}=min{n,n+1,n+2}). Correspondingly, duringt+3 the minimum is calculated from the samples n+3 and MIN3 and theresult is the minimum in neighbourhood 4*1, i.e. MIN4 (=min{MIN3,n+3}=min{n,n+1,n+2,n+3}). By continued analysis the minimum is reachedin dimension W*1, where W is the horizontal dimension of theneighbourhood (W=5 in the sample above).

Because at the moment t0 the minimum operations ##EQU1## can beperformed in parallel (n+t0=sample at the moment t0), the operations canbe performed by means of the horizontal portion, comprising W operatorelements connected one after another, each of which operator elementsconsists of one comparing means and one delay means, the output of thedelay means of a preceding operator element being connected to the firstinput of the comparing means of the following operator element and theinput of the horizontal portion being connected to the first input ofthe comparing means of the first operator element and also to the secondinput of the comparing means of each operator element, whereby theoutput of the Wth operator element forms the output of the horizontalportion. The operations can thus be performed in real time in such a waythat the minimum in the local neighbourhood W*1 is obtained at the endof the chain in each clock period. Operations to be performed at themoment t0 are depicted in Table 3.

                  TABLE 3                                                         ______________________________________                                        Operations to be performed at the moment t0                                   ______________________________________                                        t0 - 1 t0 t0 + 1                                                               ##STR9##                                                                                         ##STR10##                                                 ______________________________________                                    

On the other hand, the vertical operation can be performed by means ofthe vertical portion, comprising H operator elements connected one afteranother, the output of the delay means of a preceding operator elementbeing connected to the first input of the comparing means of thefollowing operator element, whereby the output of the Hth operatorelement forms the output of the vertical portion, and H delay lines withx+1 delay means connected one after another, the input of the verticalportion being connected both to the first and the second input of thecomparing means of the first operator element and also to the input ofthe first delay line and the output of each delay line being connectedboth to the second input of the comparing means of the followingoperator element and to the input of the following delay line.

The function of the vertical portion is visualized in Table 4. Theuppermost horizontal line shows the incoming data stream (from thehorizontal portion) delayed by one clock period (=MIN1). In this table,the minimum (erosion) in neighbourhood 1*5 is searched for. Each linepresents the minimum in a certain neighbourhood, which can be calculatedin the manner shown in the table. The arrows show the route of the datastream leading to the calculation of the first neighbourhood 1*5.

                                      TABLE 4                                     __________________________________________________________________________    Operating principle of a vertical minimum (erosion) filter                    operating in neighbourhood 1*5                                                __________________________________________________________________________    a) data to be processed                                                        ##STR11##                                                                    b) processed data                                                              ##STR12##                                                                                                     ##STR13##                                    __________________________________________________________________________

In the method, the minimum is searched for in the samples, n, n+x, n+2x,n+3x, . . . , n+(H-1)x to be obtained from the horizontal portion, whereH is the vertical dimension of the nieghbourhood (H=5 is example above)and x is the line length of the data to be processed.

Sample n is received by the input of the vertical portion (=minimum inneighbourhood 1*1=MIN1=min{n}) at the moment t, sample n+x at the momentt+1 etc. During t+1 the minimum is calculated from the samples n and n+xand the result is the minimum in neighbourhood 1*2, i.e. MIN2(=min{MIN1,n+x}=min{n,n+x}). During t+2 the minimum is calculated fromthe samples n+2x and MIN2 and the result is the minimum in neighbourhood1*3, i.e., MIN3 (=min{MIN2, n+2x}=min{n,n+x,n+2x}). By containedanalysis the minimum is reached in neighbourhood 1*H.

Because at the moment t0 the minimum operations ##EQU2## can beperformed in parallel (n+t0=sample at the moment t0), the operations canbe performed in real time. The minimum in the local neighbourhood 1*E isobtained at the end of the chain in each clock period. Operations to beperformed at the moment t0 are described in table 5.

                                      TABLE 5                                     __________________________________________________________________________    Operations to be performed at the moment t0                                   __________________________________________________________________________    t0 - 1 t0 t0 + 1                                                               ##STR14##                                                                                          ##STR15##                                               __________________________________________________________________________

The horizontal and vertical portions based on the minimum operation havebeen discussed above, which portions perform together the operation oferosion of mathematical morphology in neighbourhood W*H. A maximumoperator performing dilation can also be subjected to a similarexamination.

Dilation and erosion can both be performed with the same structure. Theoperation is reversed by changing the basic operators searching for theminimum for those searching for the maximum or vice versa.

BRIEF DESCRIPTION OF THE DRAWINGS

A filter according to the invention is described below in more detailwith reference to the enclosed drawing, in which:

FIG. 1 shows the structure of a prior art filter;

FIG. 2 shows the structure of a horizontal portion of a filter accordingto the invention, and

FIG. 3 shows the structure of a vertical portion of the filter accordingto the invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT

FIG. 2 shows the structure of a horizontal portion of a filter accordingto the invention. This horizontal portion comprises operator elements,the number of which is W and each of which consists of one comparingmeans min and one delay means D, the operator elements being connectedone after another in such a way that the output of the delay means D ofa preceding operator element is connected to the first input of thecomparing means min of the following operator element. The input IH ofthe horizontal portion is connected to the first input of the comparingmeans min of the first operator element and also to the second input ofthe comparing means min of each operator element. Thus each operatorelement receives simultaneously the value coming to its input IH and theresult of the operation (for instance minimum) of the preceding operatorelement delayed in each operator element approximately by the delay ofthe delay means D, i.e., in practice most usually by one clock period.The output of the horizontal portion of FIG. 2 is formed by the outputMINW of the Wth operator element. This represents the minimum or maximumvalues searched for in the portions including W successive samples,which portions have been allowed to slide over the one after anotherorganized horizontal lines of the basic data matrix.

FIG. 3 shows the structure of a vertical portion of a filter accordingto the invention. This vertical portion comprises operator elements, thenumber of which is H and which are similar to those in FIG. 2, theoperator elements being connected one after another in such a way thatthe output of the delay means D of a preceding operator element isconnected to the first input of the comparing means of the followingoperator element. The output of the Hth operator element forms theoutput MINH of the vertical portion. The vertical portion furthercomprises delay lines, the number of which is H and each of whichcomprises X+1 delay means D connected one after another, the input IV ofthe vertical portion being connected both to the first and the secondinput of the comparing means min of the first operator element and alsoto the input of the first delay line. On the other hand, the output ofeach delay line is connected both to the second input of the comparingmeans min of the following operator element and to the input of thefollowing delay line. By means of this vertical portion, the erosion ordilation process can be applied to sets including H sample values beloweach other of the vertical rows of the basic data matrix or to find theminimum or maximum value of each of the sets.

A very substantial property of the filter according to the invention isthe possibility of connecting horizontal and vertical portions formingthe filter one after another in a desired manner. The most conventionalway is to connect one horizontal portion and one vertical portion toeach other, whereby the filter processes a segment of a basic datamatrix. When such a filter suited for processing a rectangular segmentis realized as a concrete component, such as an integrated circuit, theproblem easily emerges that the sphere of influence of the circuit,i.e., the dimensions of the segments thereof are not sufficient for theapplication planned. As to these dimensions, however, the filter of theinvention can be extended very easily by connecting filter structurescapable of processing a certain segment one after another in such a waythat the horizontal portions thereof and the vertical portions,respectively, are connected one after another, which provides a filterstructure the dimensions of the processing neighbourhood of which areequal to the sum of the dimensions of the parts thereof. For instance,when two filters capable of processing a W×H segment are connected oneafter another in this way, a filter is provided the dimensions of theprocessing neighbourhood of which are 2W×2H. To make a connection likethis possible, the circuit of FIG. 2 shows beside its input IH anotherinput MIN and beside its output another output IHO. To make such achaining of horizontal portions possible, it is also necessary to breakthe connection between the input IH of the horizontal portion and thefirst input of the comparing means of the first operator element, whichnow gets its own input MIN. On the other hand, the other output IHOrelates to the line through which the other inputs of all operatorelements are supplied with a respective initial value. By connecting thehorizontal portion of the second filter after the horizontal portion ofthe first filter, the horizontal portion can be extended to continuequite like the chain shown in FIG. 2, whereby its length increases inthe proportion with the number of operator elements of this increasedhorizontal portion.

A similar chaining can be realized also with the vertical portions shownin FIG. 3. Then the output MINH of a preceding vertical portion isconnected to the input IV of the following vertical portion, and on theother hand, the output DLO of the last delay line is connected to theinput DLI of the delay line of the vertical portion of the followingfilter. This input DLI thus connected to the input of the first delayline of the vertical portion is then naturally disconnected from thefirst input IV of the first operator element of the vertical portion inquestion.

Furthermore, it shall be noted that filters according to the inventioncan be connected one after another also in many other ways, e.g., insuch a way that an operation of erosion is at first applied to the basicdata by means of a filter according to the invention, and immediatelyafter that, an operation of dilation by means of a similar filter, butnow naturally arranged to search for maximums. Consequently, arbitrarynumbers of filters according to the invention, both dilation and erosionfilters, can be connected one after another in an arbitrary mannerwithout disturbing the function of the filters. In this way, imagesfiltered in different ways can be produced for instance in imageprocessing, which images, say subtracted from each other, bring forwardthe very property searched for with special emphasis.

In the filter according to the invention, a division of the operatorsinto separate horizontal and vertical portions in the localneighbourhood W*H decreases the number of necessary maximum/minimumoperators (dilation/erosion operators) from W*H to W+H compared with thetraditional structure of realization.

Further, a division of the operators into horizontal and verticalportions decreases the extent of wiring required for the realization ofelectronics or IC in the proportion (W+H)/(W*H) compared with thetraditional solution.

The operating and realizing principle of the filter according to theinvention makes a flexible modular extension from the neighbourhood 1*1till the neighbourhood W*H possible, in which W and H are optionalpositive integers. A restriction is caused only by the dimensions of thebasic data to be processed, so that Wsx and Hsy.

The neighbourhood W*H can easily be configured to neighbourhood W₁ *H₁,in which 1≦W₁ ≦W and 1≦H₁ ≦H. This property makes a versatile effectiveimage segmentation for instance in image processing possible.

An advantage of the filter is its capability of eliminating unnecessarydata samples whenever it is observed that they cannot be maximums(dilation) or minimums (erosion) of the neighbourhood W*H, whichdecreases the amount of the data to be processed. Due to this, themethod is very quick, the delay is defined only by the time required forone maximum/minimum operation. The operations can be performed in realtime. If, for instance, a line camera is used for producing an image, noseparate extensive image memory is needed for storing the data to beprocessed. The filter suits especially well for image processing(pattern recognition, image segmentation) and decreases remarkably therealization costs compared with conventional solutions.

The filter of the invention has above been described by means of oneexemplifying structure only and it is understandable that it could bechanged to some extent without differing from the scope of protectiondefined by the enclosed claims, however.

We claim:
 1. A filter for applying a selected one of dilation anderosion operations of mathematical morphology using a W×H rectangularstructuring element to a two-dimensional matrix of discrete values, thewidth of the matrix being x and the height being y, said filtercomprising:(a) a horizontal portion for applying said selected one ofsaid dilation and erosion operations to a W×1 local neighbourhood, saidhorizontal portion having an input and an output and comprising Widentical operator elements connected one after another, each of saidoperator elements comprising:(i) comparing means having two inputs andone output for producing the lesser or greater of the input values atsaid output, in the cases of said erosion and said dilation operations,respectively; and (ii) delay means having one input and one output, theoutput of said comparing means being connected to the input of saiddelay means and the output of the delay means being connected to thefirst input of the comparing means of a following one of said operatorelements; the input of the horizontal portion being connected to thefirst input of the comparing means of a respective first operatorelement and also to the second input of the comparing means of each ofsaid operator elements in the horizontal portion, the output of thedelay means of the Wth of said operator elements forming the output ofsaid horizontal portion, and (b) a vertical portion for applying saidselected one of said dilation and said erosion operations to a 1×H localneighbourhood, said vertical portion having an input and an output andcomprising:H operator elements identical with said operator elements ofthe horizontal portion and connected one after another; and H delaylines each having an input and an output and comprising x+1 furtherdelay means connected one after another; the input of said verticalportion being connected to both first and second inputs of the comparingmeans of a respective first operator element of said vertical portionand also to the input of the first of said delay lines, the output ofeach delay line being connected both to the second input of thecomparing means of a following one of said operator elements and to theinput of the following delay line, and the output of the respective Hthoperator element forming the output of said vertical portion; saidhorizontal and vertical portions being connected one after the othersuch that the output of one of said portions is connected to the inputof the other of said portions, the input of the first one of saidportions forming the input of the filter to which the matrix elementsare serially applied, and the output of the second one of said portionsforming the output of the filter.
 2. A filter for applying an operationassociated with mathematical morphology using a W×H rectangularstructuring element to a two-dimensional matrix of discrete values, thewidth of the matrix being x and the height being y, the filtercomprising:(a) a horizontal portion for applying said operation to a W×1local neighbourhood, said horizontal portion having an input and anoutput and comprising W identical horizontal operating means connectedone after another, each of said operating means comprising:(i) firstcomparing means having two inputs for receiving respective input valuesand one output for producing a comparison output; and (ii) first delaymeans having one input and one output, the output of said firstcomparing means being connected to the input of said first delay meansand the output of the first delay means being connected to the firstinput of the first comparing means of a following one of said horizontaloperating means; wherein the input of the horizontal portion isconnected to a respective first input of the first comparing means of arespective first of said horizontal operating means and also to thesecond input of the first comparing means of each of said horizontaloperating means; wherein the output of the respective first delay meansof the Wth of said operating means forms the output of said horizontalportion, and (b) a vertical portion of applying said operation to a 1×Hlocal neighbourhood, said vertical portion having an input and an outputand comprising:H vertical operating means comprising respective secondmeans for comparing and second means for delaying identical thoseassociated with said horizontal operating means and connected one afteranother; and H delay lines each having an input and an output andcomprising x+1 further delay means for delaying connected one afteranother; wherein the input of said vertical portion is connected to bothfirst and second inputs of the second comparing means of a respectivefirst of said vertical operating means and also to the input of thefirst of said delay lines, wherein the output of each delay line isconnected both to the second input of the second comparing means of arespective following one of said vertical operating means and to theinput of the following one of said delay lines, wherein the output ofthe respective Hth vertical operating means forms the output of saidvertical portion; wherein said horizontal and vertical portions areconnected one after the other so as to permit a respective output of oneof said portions to be connected to an associated input of the other ofsaid portions, wherein the input of the first one of said portions formsthe input of the filter to which the matrix elements are seriallyapplied, and wherein the output of the second one of said portions formsthe output of the filter.
 3. The filter as recited in claim 2, whereinsaid operation is an erosion operation and wherein said comparing meanscomprises comparing means for generating said comparison valuerepresenting a minimum of said two input values.
 4. The filter asrecited in claim 2, wherein said operation is a dilation operation andwherein said comparing means comprises comparing means for generatingsaid comparison value representing a maximum of said two input values.